import request from "@/utils/request";

/**  律师数据分页查询参数 */
export interface LawyerPageQuery {
  current?: number;
  pageSize?: number;
  cityNo?: string;
  lawFirmId?: number;
  lawyerName?: string;
  keywords?: string;
  jobTitle?: string;
  jobId?: number;
}
/** 律师表单 */
export interface LawyerForm {
  isUpload?: boolean;
  id?: number;
  lawyerNo?: string;
  lawyerName?: string;
  lawFirmId?: string;
  lawFirmName?: string;
  phone?: string;
  jobTitle?: string;
  newJobTitle?: string[];
  jobId?: number;
  categoryLabel?: string;
  newCategoryLabel?: any;
  lawyerLevel?: number;
  lawyerScore?: number;
  careerTime?: string;
  lawFirmAdmin?: number;
  certificationMark?: number;
  belongCityNo?: string;
  belongCityName?: string;
  workForNum?: number;
  certificateImg?: string;
  reservationAmount?: number;
  reservationPersonLimit?: string;
  avatarUrl?: string;
  newAvatarUrl?: string[];
  phoneReservationAmount?: number;
  address?: string;
  onlineReservationAmount?: number;
  certificateNo?: string;
}
/** 律师数据分页对象 */
export interface LawyerPageVO {
  current: number;
  pages: number;
  records: any;
  size: number;
  total: number;
  belongCityName?: string;
  belongCityNo?: number;
  categoryInfoList?: any;
  jobTitle?: string;
  avatarUrl: string;
}
class lawyerAPI {
  /** 获取律师数据分页列表 */
  static getLawyer(params: LawyerPageQuery) {
    return request<any, LawyerPageVO>({
      url: "/api/lawyer_info/getPage",
      method: "post",
      data: params,
    });
  }
  /** 根据id获取律师数据列表 */
  static getLawyerById(id: number) {
    return request<any, LawyerPageVO>({
      url: `/api/lawyer_info/${id}`,
      method: "get",
      // data: params,
    });
  }
  /** 上传律师头像 */
  static uploadAvatar(params: any) {
    return request({
      url: "/api/lawyer_info/upload-avatar",
      method: "post",
      headers: {
        "Content-Type": "multipart/form-data",
      },
      data: params,
    });
  }
  /** 新增+修改 律师信息 */
  static updateLawyer(params: LawyerForm) {
    return request<any, PageResult<LawyerPageVO[]>>({
      url: "/api/lawyer_info",
      method: "post",
      data: params,
    });
  }
  /** 根据id删除律师信息 */
  static deleteLawyer(id: number) {
    return request({
      url: `/api/lawyer_info/${id}`,
      method: "delete",
      // data: params,
    });
  }
  /** 批量删除律师信息 */
  static deleteLawyerBatch(ids: string) {
    return request({
      url: `/api/lawyer_info/deleteBatch?ids=${ids}`,
      method: "delete",
      // data: ids,
    });
  }
}

export default lawyerAPI;
